<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <title>歌曲列表</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="../static/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="../static/css/font-awesome.min.css" rel="stylesheet"/>
    <!-- bootstrap-table 表格插件样式 -->
    <link href="../static/ajax/libs/bootstrap-table/bootstrap-table.min.css?v=20200727" rel="stylesheet"/>
    <link href="../static/css/animate.css" rel="stylesheet"/>
    <link href="../static/css/style.css?v=20200903" rel="stylesheet"/>
    <link href="../static/ruoyi/css/ry-ui.css?v=4.4.0" rel="stylesheet"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>歌手：</label>
                            <input type="text" name="artist"/>
                        </li>
                        <li>
                            <label>歌曲名：</label>
                            <input type="text" name="name"/>
                        </li>
                        <li>
                            <label>状态：</label>
                            <select name="isDeleted">
                                <option value="">全部</option>
                                <option value="">正常</option>
                                <option value="">删除</option>
                            </select>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()">
                <i class="fa fa-plus"></i> 添加
            </a>
            <!--            <a class="btn btn-primary single" onclick="$.operate.edit()">-->
            <!--                <i class="fa fa-edit"></i> 修改-->
            <!--            </a>-->
            <a class="btn btn-danger multiple" onclick="$.operate.removeAll()">
                <i class="fa fa-remove"></i> 删除
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table-list"></table>
        </div>
    </div>
</div>

<a id="scroll-up" href="#" class="btn btn-sm display"><i class="fa fa-angle-double-up"></i></a>
<script src="../static/js/jquery.min.js"></script>
<script src="../static/js/bootstrap.min.js"></script>
<!-- bootstrap-table 表格插件 -->
<script src="../static/ajax/libs/bootstrap-table/bootstrap-table.min.js?v=20200727"></script>
<script src="../static/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js?v=20200727"></script>
<script src="../static/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js?v=20200727"></script>
<!-- jquery-validate 表单验证插件 -->
<script src="../static/ajax/libs/validate/jquery.validate.min.js"></script>
<script src="../static/ajax/libs/validate/messages_zh.min.js"></script>
<script src="../static/ajax/libs/validate/jquery.validate.extend.js"></script>
<!-- jquery-validate 表单树插件 -->
<script src="../static/ajax/libs/bootstrap-treetable/bootstrap-treetable.js"></script>
<!-- 遮罩层 -->
<script src="../static/ajax/libs/blockUI/jquery.blockUI.js"></script>
<script src="../static/ajax/libs/iCheck/icheck.min.js"></script>
<script src="../static/ajax/libs/layer/layer.min.js"></script>
<script src="../static/ajax/libs/layui/layui.js"></script>
<script src="../static/ruoyi/js/common.js?v=4.4.0"></script>
<script src="../static/ruoyi/js/ry-ui.js?v=4.4.0"></script>
<script type="text/javascript">

    let ctx = storage.get('ctx')
    let prefix = ctx + "music";
    let playlist = ctx + "playlist";
    let id = $.url.param('id');
    console.log(id);
    $(function () {
        var options = {
            id: "bootstrap-table-list",
            url: playlist + "/pageById.do?id=" + id,
            createUrl: playlist + "/addMusic.html?id=" + id,
            // updateUrl: prefix + "/edit.html?id={id}",
            removeUrl: prefix + "/delete.do",
            // exportUrl: prefix + "/export.do",
            modalName: "歌曲",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '歌曲ID'
                },
                {
                    field: 'artist',
                    title: '歌手'
                },
                {
                    field: 'name',
                    title: '歌曲名'
                },
                {
                    field: 'album',
                    title: '所属专辑'
                },
                {
                    field: 'duration',
                    title: '歌曲时长'
                },
                {
                    field: 'image',
                    title: '图片',
                    formatter: function (value, row, index) {
                        return $.table.imageView(value);
                    }
                },
                {
                    field: 'isDeleted',
                    title: '状态',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        if (value == -1 || value == -2) {
                            actions.push($.common.sprintf("<span class='%s'>%s</span>", 'badge badge-success', '删除'));
                        } else {
                            actions.push($.common.sprintf("<span class='%s'>%s</span>", 'badge badge-danger', '正常'));
                        }
                        return actions.join('');
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        // actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>